package com.airsaid.pickerviewlibrary;

import android.util.Log;
import android.view.View;

import com.airsaid.pickerviewlibrary.adapter.ArrayWheelAdapter;
import com.airsaid.pickerviewlibrary.listener.OnItemSelectedListener;
import com.airsaid.pickerviewlibrary.widget.wheelview.WheelView;

import java.util.ArrayList;

/**
 * 生肖选择view
 *
 * @author yxj on 2022/7/11
 */
public class ChoiceItemWheel<T> {


    private View view ;
    private WheelView wv ;
    private ArrayList<T> list ;


    public ChoiceItemWheel(View view) {
        this.view = view ;
        wv = (WheelView) view;
    }



    /**
     * @param arrayList
     */
    public void setData(ArrayList<T> arrayList){
        list = arrayList ;
        wv.setAdapter(new ArrayWheelAdapter(list));// 设置显示数据
        wv.setCurrentItem(0);// 初始化时显示的数据
    }


    /**
     * 设置滚动文字大小
     */
    public void setTextSize(float size){
        if(wv != null)
            wv.setTextSize(size);
    }



    public int getCurrentItems(){
        int p = wv.getCurrentItem() ;
        Log.v("[choiceItemView]","[choiceItemView]->p="+p);
        return p;
    }
}
